﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="course_arrange.aspx.cs" Inherits="course_arrange" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>排课</title>
    <style>
         .wellcome{
            width:103%;
            height:80px;
            font-style:italic;
            text-align:center;
            margin:-10px -5px;
            border:2px solid transparent;
            background-color:rgba(0, 255, 255, 0.54);
        }
         a{
             text-decoration:none;
         }
        .title{
            width:500px;
            text-align:center;
            margin:0 auto;
        }
        .select{
            width:130px;
            margin:auto;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <div class="wellcome"> 
            <h1>学生选课系统</h1>
        </div>
        <div style="font-weight: 700" class="title">
             
            <br />
            <br />
            <asp:LinkButton ID="LinkButton3" runat="server" BackColor="#CCCCCC" BorderColor="Silver" BorderStyle="Outset" Font-Size="Larger" Width="90px" PostBackUrl="~/Main.aspx">首页</asp:LinkButton>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;
            <asp:LinkButton ID="LinkButton1" runat="server" BackColor="#CCCCCC" BorderColor="Silver" BorderStyle="Outset" Font-Size="Larger" Width="124px" OnClick="LinkButton1_Click">课程安排</asp:LinkButton>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <asp:LinkButton ID="LinkButton2" runat="server" BackColor="#CCCCCC" BorderColor="Silver" BorderStyle="Outset" Font-Size="Larger" OnClick="LinkButton2_Click" Width="103px">选课</asp:LinkButton>
            <br />
            <br />
             
        </div>
        <asp:DetailsView ID="DetailsView1" runat="server" AllowPaging="True" AutoGenerateRows="False" BackColor="White" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="3" DataKeyNames="cno" DataSourceID="SqlDataSource1" GridLines="Horizontal" Height="50px" HorizontalAlign="Center" Width="125px">
            <AlternatingRowStyle BackColor="#F7F7F7" />
            <EditRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
            <Fields>
                <asp:BoundField DataField="cno" HeaderText="课程号" ReadOnly="True" SortExpression="cno" />
                <asp:BoundField DataField="cname" HeaderText="课程名" SortExpression="cname" />
                <asp:BoundField DataField="time" HeaderText="上课时间" SortExpression="time" />
                <asp:BoundField DataField="place" HeaderText="上课地点" SortExpression="place" />
                <asp:BoundField DataField="credit" HeaderText="学分" SortExpression="credit" />
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowInsertButton="True" />
            </Fields>
            <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
            <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
            <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
            <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
        </asp:DetailsView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Web_ExperimentConnectionString %>" DeleteCommand="delete from course where cno=@cno" InsertCommand="insert into course values(@cno,@cname,@time,@place,@credit)" SelectCommand="SELECT * FROM [course]" UpdateCommand="update course set cno=@cno,cname=@cname,time=@time,credit=@credit  where cno=@cno"></asp:SqlDataSource>
        <div class="select">
            <asp:Label ID="Label1" runat="server" Font-Size="X-Large" Text="可选课程"></asp:Label>
        </div>
        <br />
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" BackColor="White" BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" CellPadding="4" DataKeyNames="cno" DataSourceID="SqlDataSource2" HorizontalAlign="Center" PageSize="5" OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
            <Columns>
                <asp:BoundField DataField="cno" HeaderText="课程号" ReadOnly="True" SortExpression="cno" />
                <asp:BoundField DataField="cname" HeaderText="课程名" SortExpression="cname" />
                <asp:BoundField DataField="time" HeaderText="上课时间" SortExpression="time" />
                <asp:BoundField DataField="place" HeaderText="上课地点" SortExpression="place" />
                <asp:BoundField DataField="credit" HeaderText="学分" SortExpression="credit" />
                <asp:ButtonField Text="选课"  ButtonType="Button" CommandName="select_course" HeaderText="选课">
                <ControlStyle Font-Underline="True" />
                <FooterStyle Font-Underline="True" BorderStyle="Outset" />
                <HeaderStyle BorderStyle="Outset" />
                </asp:ButtonField>
            </Columns>
            <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
            <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
            <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
            <RowStyle BackColor="White" ForeColor="#003399" />
            <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
            <SortedAscendingCellStyle BackColor="#EDF6F6" />
            <SortedAscendingHeaderStyle BackColor="#0D4AC4" />
            <SortedDescendingCellStyle BackColor="#D6DFDF" />
            <SortedDescendingHeaderStyle BackColor="#002876" />
        </asp:GridView>
        <br />
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:Web_ExperimentConnectionString %>" SelectCommand="SELECT * FROM [course]"></asp:SqlDataSource>
        <div class="select">
            <asp:Label ID="Label2" runat="server" Font-Size="X-Large" Text="已选课程"></asp:Label>
        </div>

        <asp:GridView ID="GridView2" runat="server" AllowPaging="True" AutoGenerateColumns="False" BackColor="White" BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" CellPadding="4" DataSourceID="SqlDataSource3" HorizontalAlign="Center" PageSize="5" OnSelectedIndexChanged="GridView2_SelectedIndexChanged">
            <Columns>
                <asp:BoundField DataField="sno" HeaderText="学号" SortExpression="sno" />
                <asp:BoundField DataField="cno" HeaderText="课程号" SortExpression="cno" />
                <asp:BoundField DataField="cname" HeaderText="课程名" SortExpression="cname" />
                <asp:BoundField DataField="time" HeaderText="上课时间" SortExpression="time" />
                <asp:BoundField DataField="place" HeaderText="上课地点" SortExpression="place" />
                <asp:BoundField DataField="credit" HeaderText="学分" SortExpression="credit" />
                <asp:ButtonField Text="退选" HeaderText="退选" ButtonType="Button" CommandName="retreat_course">
                <ControlStyle Font-Underline="True" />
                </asp:ButtonField>
            </Columns>
            <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
            <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
            <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
            <RowStyle BackColor="White" ForeColor="#003399" />
            <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
            <SortedAscendingCellStyle BackColor="#EDF6F6" />
            <SortedAscendingHeaderStyle BackColor="#0D4AC4" />
            <SortedDescendingCellStyle BackColor="#D6DFDF" />
            <SortedDescendingHeaderStyle BackColor="#002876" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:Web_ExperimentConnectionString %>" SelectCommand="SELECT * FROM [selected]"></asp:SqlDataSource>

    </form>
</body>
</html>
